<%-- 
    Document   : PatientProfile
    Created on : Apr 1, 2012, 12:41:45 PM
    Author     : David
--%>

<%@page import="java.text.SimpleDateFormat"%>
<%@page import="edu.uta.tsrh.specialnotes.controllers.RecordController"%>
<%@page import="edu.uta.tsrh.specialnotes.misc.PatientPhoneCall"%>
<%@page import="edu.uta.tsrh.specialnotes.misc.PatientNote"%>
<%@page import="java.util.ArrayList"%>
<%@page import="edu.uta.tsrh.specialnotes.misc.PatientRecord"%>
<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="java.sql.*"%> 
<%@page import="model.PatientInfo" %>

        <%
        String patientId = request.getParameter("patient");
        PatientRecord pRecord = RecordController.getPatientRecord(patientId);
        %>
        <div class="mainPanel">   
            <div class="panel">
                <h2>Patient Information</h2>
                <ul class="infoPanel">
                    <li><div class='name'>First Name:</div> <div><%= pRecord.getFirstName()%></div></li>
                    <li><div class='name'>Last Name:</div> <div class='value'><%= pRecord.getLastName()%></div></li>
                    <li><div class='name'>Patient ID:</div> <div class='value'><%= pRecord.getId()%></div></li>
                    <li><div class='name'>Date of Birth:</div> <div class='value'><%= new SimpleDateFormat("EEE, MM/d/yyyy 'at' kk:mm zzzz").format(pRecord.getDOB())%></div></li>
                    <li><div class='name'>Contact Phone:</div> <div class='value'><%= pRecord.getContactPhone()%></div></li>
                </ul>
            </div>
            
            <div class="panel phonePanel">
            <h2>Phone Calls</h2>
            <ul>
                <%
                ArrayList<PatientPhoneCall> calls = pRecord.getPhoneCalls();
                for (int i = 0; i < calls.size(); i++) {
                %>
                <li>

                    <ul class="infoPanel">
                        <li><h3><%= calls.get(i).getTitle() %></h3></li>
                        <li><strong><%= new SimpleDateFormat("EEE, MM/d/yyyy 'at' kk:mm zzzz").format(calls.get(i).getDate()) %></strong></li>
                        <li><div class="name">Caller:</div> <div class="value"><%= calls.get(i).getCaller() %></div> </li>
                        <li><div class="name">Source Number:</div><div class="value"> <%= calls.get(i).getSourceNumber() %></div></li>
                        <li><p><%= calls.get(i).getContent() %></p></li>
                    </ul>
                </li>
                <%}%>
                
            </ul>
            <form method="GET" action=''>
                <input type='hidden' name="patient" value='<%= pRecord.getId() %>' />
                <input type='submit' class='linkButton blue button' value="Add Phone Call" />
                <input type="hidden" name='page' value="AddPhoneCall" />
            </form>
            </div>
        </div>
        
        <div class="panel notesPanel">
            <h2>Notes</h2>
            <ul>
                <%
                ArrayList<PatientNote> notes = pRecord.getNotes();
                for (int i = 0; i < notes.size(); i++) {
                        out.println("<li>");
                        out.println("<div class='deleteX'><a class='confirm' href='HideNote?id=" + notes.get(i).getId() + "'>delete</a></div>");
                        out.println("<a href='/TSRH/?page=ViewNote&id=" + notes.get(i).getId() + "&patient=" + pRecord.getId() + "'><h3>" + notes.get(i).getTitle() + "</h3>");
                        out.println("<p>" + notes.get(i).getContent() + "</p></a></li>");
                    }
                %>
            </ul>
            <form method="GET" action='/TSRH/'>
                <input type='hidden' name="patient" value='<%= pRecord.getId() %>' />
    
                <input type='submit' class='linkButton blue button' value="Add Note" />
                <input type="hidden" name='page' value="AddNote" />
      
            </form>
        </div>
        